import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'ellipsis',
})
export class EllipsisPipe implements PipeTransform {
  transform(value: string, length = 20): any {
    if (!value) {
      return '';
    }
    let substr = value.substr(0, length);
    if (substr.length != value.length) {
      substr += '...';
    }
    return substr;
  }
}
